<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws.
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.).
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations).
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Blog/classes/PhpFox_ComponentNewBlogs.class.php, $Author:  $ */



/** Component for creating a new blog
 *
 * @version $Id: PhpFox_ComponentNewBlogs.class.php 46 2007-12-14 23:12:21Z phpfoxsv $
 * @package module.blog
 */
class PhpFox_Mod_Blog_ComponentNewBlogs extends BaseComponent
{
    function process()
    {
        $oSecurityService = App::getModuleService('Account', 'Security');
        /* @var $oSecurityService PhpFox_Mod_Account_ServiceSecurity */
        $oTpl = $this->_oModule->getTemplate();

        if (!$oSecurityService->checkAccess('blogs', '', false))
        {
            return '';
        }
        $iCount = App::getParam('public.new_blogs_count');

       	$aItems = $this->oDatabase->getRows("SELECT j.id, j.title, j.time, j.text, u.user FROM
       		". App::getT('journal') ." AS j
       		LEFT JOIN ". App::getT('user') ." AS u ON(j.user_id = u.id)
       		ORDER BY j.time DESC LIMIT 0,". $iCount ."");

        $oTpl->assignSrc('aItems', $aItems);
        $oTpl->assign(array(
        	'sUImageUrl' => App::getParam('user.pic.url'),
        ));
        return $oTpl->fetch('NewBlogs.html');
    }
}
?>